home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 9
/
The PC-SIG Library on CD ROM - Ninth Edition.iso
/
1601_700
/
DISK1665
/
DISK1665.ZIP
/
LANGTC.KED
< prev
next >
Wrap
Text File
|
1980-01-01
|
48KB
|
1,076 lines
.Notice - Last Update:1988/09/26 17:30
Importance Notice: The information contained in this option are for quick
reference only. The accuracy of it should be based on your
language reference manual.
Set Up By : Kuang H. Tseng
Language : Turbo C(R) 2.0 by Borland
. 1. Language Elements
Character Sets
- Uppercase letters from A to Z, lowercase leter from a to z
- Decimal digits from 0 to 9
- Special characters '_' and '$'
Data Types - (refer to separate key line for more)
Identifiers - (refer to separate key line for more)
Keywords - (refer to separate key line for more)
Constants - (refer to separate key line for more)
Comments - characters between '/*'' and '*/'
Statements - (refer to separate key line for more)
Functions - (refer to separate key line for more)
Operators - (refer to separate key line for more)
Declarations
- Function Declarations
- Variable Declarations
- Type Declarations
Program Line
Preprocessor Directives - (refer to separate key line for more)
Compiler Directives - (refer to separate key line for more)
. 2. Data types
char 1 byte -128 to 127
int 2 -32768 to 32767
short 2 -32768 to 32768
long 4 -2147483648 to 2147483647
unsigned char 1 0 to 255
unsigned 2 0 to 65535
unsigned short 2 0 to 65535
unsigned long 4 0 to 4294967296
enum 2 0 to 65535
float 4 3.4E-38 to 3.4E+38
double 8 1.7E-308 to 1.7E+308
long double 8 1.7E-308 to 1.7E+308
. 3.1 Identifiers
- Use to name the variables, types, functions and labels
- Consists of letters,digits,underscores but begins with letters or underscor
- First 32 characters are significant
- Case sensitive
. 3.2 Keywords
asm auto break case edecl char const continue
default do double else enum extern far float
for goto huge if int interrupt long near
pascal register return short signed sizeof static struct
switch typedef union unsigned void volatile while
_cs _ds _es _ss _AH _AL _AX _BH
_BL _BX _CH _CL _CX _DH _DL _DX
_BP _DI _SI _SP
. 3.3 Constants
Integer Constants :
- Decimal Constants
- Octal Constants - digits with leading 0O
- Hexadecimal Constants - digits with leading 0x or 0X
Floating-point Constants : including an integer portion, a fraction portion,
and an exponent. Have type double
Character Constants : a character enclosed within single quotation marks ' '
String Constants : a sequence of characters enclosed within " "
. 3.4 Global Variables
extern int _argc; /* count of command-line arguments */
extern char *_argv; /* array of pointers to command-line arguments */
extern int daylight; /* switch for daylight saving time or standard time */
extern int directvideo; /* flag to control console output */
extern int _8087; /* coprocessor chip flag */
extern char *environ[]; /* array of pointers to DOS environment strings */
extern int errno; /* enable perror to print error messages */
extern int _doserrno; /* enable perror to print error messages */
extern char *sys_errlist; /* enable perror to print error messages */
extern int sys_nerr; /* enable perror to print error messages */
extern int _fmode; /* determine default file-translation mode */
extern unsigned _heaplen; /* length of near heap */
extern unsigned char _osmajor/_osminor; /* DOS major/minor version no.*/
extern unsigned int _psp; /* segment address of PSP */
extern unsigned _stklen; /* size of stack */
extern long timezone; /* difference in sec between local time and GMT */
extern char *tzname[2]; /* array of pointers to time zone names /
extern unsigned int _version; /* DOS version number */
. 4. Operators and the Precedence
[] array 1
() function procedence level 1 left to right
. or -> member selection 1
! logical not 2 right to left
~ bitwise complement 2
++ increment 2
-- decrement 2
- arithmetic negation 2
(type) type case 2
* indirection 2
& address of 2
SIZEOF size in bytes 2
* multiplication 3 left to right
/ division 3
% modulus 3
+ addition 4 left to right
- subtraction 4
<< shift left 5 left to right
>> shift right 5
< less than 6 left to right
<= less than or equal to 6
> greater than 6
>= greater than or equal to 6
== equal to 7 left to right
!= no equal to 7
& bitwise AND 8 left to right
^ bitwise exclusive XOR 9 left to right
: bitwise inclusive OR 10 left to right
&& logical AND 11 left to right
|| logical OR 12 left to right
exp1?exp2:exp3 condition 13 right to left
= simple assigment 14 right to left
+= addition assignment 14
-= subtraction assignment 14
*= multiplication assignment 14
/= division assignment 14
%= remainder assignment 14
>>= right shift assignment 14
<<= left shift assignment 14
&= bitwise AND assignment 14
:= bitwise inclusive OR assignment 14
^= bitwise exclusive OR assignment 14
, multiple expression 15
. 5.1 List of Statements
asm
break;
continue;
do...while(expression);
for ([init-exp];[cond-exp];[loop-exp])
goto label-name;
if (exp)...else (exp)
return [exp];
switch (exp) {[declaration]...[case const-exp:]...[default:...]}
while (exp) ...statement
. 5.2 List of Include Files
alloc.h -declaration for memory management functions
assert.h -define the assert debugging macro
bios.h -decalre functions used in calling ROM BIOS routines
conio.h -declare functions used in calling DOS console I/O routines
ctype.h -for character classification and conversion macros
dir.h -structures/macros/functions for working with directory
dos.h -constants/declaration for DOS calls
errno.h -constant mnemonics for error codes
fcntl.h -constants for open function
float.h -parameters for floating-point functions
graphics.h -prototypes for graphics functions
io.h -structures/declarations for lower-level I/O functions
limits.h -environment parameters,compile-time limitations
math.h -prototypes for math functins and structures for matherr funct.
mem.h -declarations for memory-manipulation functions
process.h -structures/declarations for spawn/exec functions
setjmp.h -declarations for longjmp/setjmp routines
share.h -parameters/functions for file-sharing functions
signal.h -constants/declarations for signal/raise functions
stdargs.h -macros for functions to read a variable number of arguments
stddef.h -definitions of commonly used variables/types/macros
stdio.h -constants/types/macros/declarations for stream I/O
stdlib.h -declarations for conversion/search/sort/misc functions
string.h -declarations for string/memory-manipulation functions
sys\stat.h -symbolic constants for opening/creating files
sys\timeb.h -declarations/structure of timeb for ftime function
sys\types.h -declaration of type time_t for time functions
time.h -structures/types/declarations for time-conversion functions
values.h -constants of machine dependencies for UNIX V compatibility
. 5.3 List of Functions by Group/Class with header file
Charater Classification
isalnum (ctype.h) isalpha (ctype.h) isascii (ctype.h)
iscntrl (ctype.h) isdigit (ctype.h) isgraph (ctype.h)
islower (ctype.h) isprint (ctype.h) ispunct (ctype.h)
isspace (ctype.h) isupper (ctype.h) isxdigit (ctype.h)
Data Type Conversion
atof (stdlib.h) atoi (stdlib.h) atol (stdlib.h)
ecvt (stdlib.h) fcvt (stdlib.h) gcvt (stdlib.h)
itoa (stdlib.h) ltoa (stdlib.h) strtod (stdlib.h)
strtol (stdlib.h) stroul (stdlib.h) ultoa (stdlib.h)
Character Conversion
toascii (ctype.h) tolower (stdlib.h) _tolower (stdlib.h)
toupper (stdlib.h) _toupper (stdlib.h)
Directory Control
chdir (dir.h) findfirst (dir.h) findnext (dir.h)
fnmerge (dir.h) fnsplit (dir.h) getcurdir (dir.h)
getcwd (dir.h) getdisk (dir.h) mkdir (dir.h)
mktemp (dir.h) rmdir (dir.h) searchpath (dir.h)
setdisk (dir.h)
Diagnostic
assert (assert.h) matherr (math.h) perror (errno.h)
Text Window Output Attribute Control
textcolor (conio.h) textbackground (conio.h) textattr (conio.h)
highvideo (conio.h) lowvideo (conio.h) normvideo (conio.h)
Text Window State Query
gettextinfo (conio.h) wherex (conio.h) wherey (conio.h)
Graphics - System Control
closegraph (graphics.h) detectgraph (graphics.h)
phdefaults (graphics.h) _graphfreemem (graphics.h)
_graphgetmem (graphics.h) getmoderange (graphics.h)
initgraph (graphics.h) installuserdriver (graphics.h)
installuserfont (graphics.h) registerbgidriver (graphics.h)
restorecrtmode (graphics.h) setgraphbufsize (graphics.h)
setgraphmode (graphics.h)
Graphics - Drawing
arc (graphics.h) circle (graphics.h)
drawpoly (graphics.h) ellipse (graphics.h)
getarccoords (graphics.h) getspectratio (graphics.h)
getlinesettings (graphics.h) line (graphics.h)
linerel (graphics.h) lineto (graphics.h)
moveto (graphics.h) moverel (graphics.h)
rectangle (graphics.h) setaspectratio (graphics.h)
setlinestyle (graphics.h)
Graphics - Filling
bar (graphics.h) bar3d (graphics.h)
fillellipse (graphics.h) fillpoly (graphics.h)
folldfill (graphics.h) getfillpattern (graphics.h)
getfillsettings (graphics.h) pieslice (graphics.h)
sector (graphics.h) setfillpatern (graphics.h)
setfillstyle (graphics.h)
Graphics - Screen Manipulation
cleardevice (graphics.h) setactivepage (graphics.h)
setvisualpage (graphics.h)
Graphics - Viewport Manipulation
clearviewport (graphics.h) getviewsettings(graphics.h)
setviewport (graphics.h)
Graphics - Image Manipulation
getimage (graphics.h) imagesize (graphics.h)
putimage (graphics.h)
Graphics - Pixel Manipulation
getpixel (graphics.h) putpixel (graphics.h)
Graphics - Text Output
gettextsettings (graphics.h) outtext (graphics.h)
outtextxy (graphics.h) registerbgifont (graphics.h)
setttextjustify (graphics.h) settextstyle (graphics.h)
setusercharsize (graphics.h) textheight (graphics.h)
textwidth (graphics.h)
Graphics - Color Control
getbkcolor (graphics.h) getcolor (graphics.h)
getdefaultpalette (graphics.h) getmaxcolor (graphics.h)
getpalette (graphics.h) getpalettesize (graphics.h)
setallpalette (graphics.h) setbkcolor (graphics.h)
setcolor (graphics.h) setpalette (graphics.h)
Buffer Manipulation
memccpy (mem.h, string.h) memchr (mem.h, string.h)
memcmp (mem.h, string.h) memcpy (mem.h, string.h)
memicmp (mem.h, string.h) memmove (mem.h, string.h)
memset (mem.h, string.h) movedata (mem.h, string.h)
memmem (mem.h, string.h)
I/O File Handling
access (io.h) chmod (io.h) chsize (io.h)
filelength (io.h) fstat (sys\stat.h) isatty (io.h)
lock (io.h) remove (stdio.h) rename (stdio.h)
setmode (io.h) stat (sys\stat.h) unlock (io.h)
I/O (Console)
cget (conio.h) cprintf (conio.h) cputs (conio.h)
cscanf (conio.h) getch (conio.h) getche (conio.h)
kbhit (conio.h) putch (conio.h) ungetch (conio.h)
I/O (Low Level)
_close (io.h) close (io.h) _creat (io.h)
creat (io.h) dup (io.h) dup2 (io.h)
eof (io.h) lseek (io.h) open (io.h)
read (io.h) sopen (io.h) tell (io.h)
_write (io.h) write (io.h)
I/O (Stream)
clearerr (stdio.h) fclose (stdio.h) fcloseall (stdio.h)
fdopen (stdio.h) feof (stdio.h) ferror (stdio.h)
fflush (stdio.h) fgetc (stdio.h) fgetchar (stdio.h)
fgetpos (stdio.h) fgets (stdio.h) fileno (stdio.h)
flushall (stdio.h) fopen (stdio.h) fprintf (stdio.h)
fputc (stdio.h) fputchar (stdio.h) fputs (stdio.h)
fread (stdio.h) freopen (stdio.h) fscanf (stdio.h)
fseek (stdio.h) fsetpos (stdio.h) ftell (stdio.h)
fwrite (stdio.h) getc (stdio.h) getchar (stdio.h)
gets (stdio.h) getw (stdio.h) printf (stdio.h)
putc (stdio.h) putchar (stdio.h) puts (stdio.h)
putw (stdio.h) rewind (stdio.h) scanf (stdio.h)
setbuf (stdio.h) setvbuf (stdio.h) sprintf (stdio.h)
sscanf (stdio.h) tmpnam (stdio.h) ungetc (stdio.h)
vprintf (stdio.h) vsprintf (stdio.h)
Math
acos (math.h) asin (math.h) atan (math.h)
atan2 (math.h) cabs (math.h) ceil (math.h)
_clear87 (float.h) _control87 (float.h) cos (math.h)
cosh (math.h) exp (math.h) fabs (math.h)
floor (math.h) fmod (math.h) _fpreset (float.h)
frexp (math.h) hypot (math.h) ldexp (math.h)
log (math.h) log10 (math.h) _matherr (math.h)
matherr (math.h) modf (math.h) pow (math.h)
pow10 (math.h) sin (math.h) sinh (math.h)
sqrt (math.h) _status87 (float.h) tan (math.h)
tanh (math.h)
Memory Allocation
allocmem (dos.h) brk (alloc.h) calloc (alloc.h)
coreleft (alloc.h,stdlib.h) farcalloc (alloc.h) farcoreleft (alloc.h)
farfree (alloc.h) farmalloc (alloc.h) farrealloc (alloc.h)
free (alloc.h,stdlib.h) malloc (alloc.h,stdlib.h)
realloc (alloc.h,stdlib.h) sbrk (alloc.h) setblock (dos.h)
Process Control
abort (process.h) execl (process.h) execle (process.h)
execlp (process.h) execlpe (process.h) execv (process.h)
execve (process.h) execvp (process.h) execvpe (process.h)
exit (process.h) _exit (process.h) raise (signal.h)
signal (process.h) spawnl (process.h) spawnle (process.h)
spawnlp (process.h) spawnlpe (process.h) spawnv (process.h)
spawnve (process.h) spawnvp (process.h) swawnvpe (process.h)
system (process.h)
Searching and Sorting
bsearch (stdlib.h) lfind (stdlib.h) lsearch (stdlib.h)
qsort (stdlib.h)
String Manipulation
stpcpy (string.h) strcat (string.h) strchr (string.h)
strcmp (string.h) strcmpi (string.h) strcpy (string.h)
strcspn (string.h) strdup (string.h) strerror (string.h)
stricmp (string.h) strlen (string.h) strlwr (string.h)
strncat (string.h) strncmp (string.h) strncmpi (string.h)
strncpy (string.h) strnicmp (string.h) strnset (string.h)
strpbrk (string.h) strrchr (string.h) strrev (string.h)
strset (string.h) strspn (string.h) strstr (string.h)
strtok (string.h) strupr (string.h)
BIOS System Calls
bioscom (bios.h) biosdisk (bios.h) biosequip (bios.h)
bioskey (bios.h) biosmemory (bios.h) biosprint (bios.h)
biostime (bios.h)
DOS System Calls
disable (dos.h) dosexterr (dos.h) enable (dos.h)
FP_OFF (dos.h) FP_SEG (dos.h) freemem (dos.h)
geninterrupt (dos.h) getcbrk (dos.h) getdfree (dos.h)
getdta (dos.h) getfat (dos.h) getfatd (dos.h)
getpsp (dos.h) getvect (dos.h) getverify (dos.h)
harderr (dos.h) hardresume (dos.h) hardretn (dos.h)
inport (dos.h) inportb (dos.h) int86 (dos.h)
int86x (dos.h) intdos (dos.h) intdosx (dos.h)
intr (dos.h) keep (dos.h) MK_FT (dos.h)
outport (dos.h) outportb (dos.h) parsfnm (dos.h)
peek (dos.h) peekb (dos.h) poke (dos.h)
pokeb (dos.h) randbrd (dos.h) randbwr (dos.h)
segread (dos.h) setcbrk (dos.h) setdta (dos.h)
setvect (dos.h) setverify (dos.h) sleep (dos.h)
unlink (dos.h)
Time & Date
asctime (time.h) ctime (time.h) difftime (time.h)
dostounix (dos.h) ftime (sys\timeb.h) getdate (dos.h)
gettime (dos.h) gmtime (time.h) localtime (time.h)
setdate (dos.h) settime (dos.h) stime (time.h)
time (time.h) tzset (time.h) unittodos (dos.h)
Variable_length Argument Lists
va_arg (stdarg.h) va_end (stdarg.h) va_start (stdarg.h)
Miscellaneous
abs (stdlib.h) delay (dos.h) getenv (stdlib.h)
longjump (setjmp.h) nosound (dos.h) putenv (stdlib.h)
rand (stdlib.h) setjmp (setjmp.h) sound (dos.h)
srand (stdlib.h) swab (stdlib.h)
. 5.4 List of Functions by Name order
void abort(void)
int abs(int x)
int absread(int drive,int nsects,int lsect,void *buffer)
int abswrite(int drive,int nsects,int lsect,void *buffer)
int access(const char *filename,int amode)
double acos(double x)
int allocmem(unsigned size,unsigned *segp)
void far arc(int x,int y,int stangle,int endangle,int radius)
char *asctime(const struct tm *tblock)
double asin(double x)
void assert(int test)
double atan(double x)
double atan2(double x,double y)
int atexit(atexit_t funct)
double atof/atoi/atol(const char *s)
void far bar(int left,int top,int right,int bottom)
void far bar3d(int left,int top,int right,int bottom,int depth,int topflag)
int bdos(int dosfn,unsigned int dosdx,unsigned int dosal)
int bdosptr(int dosfn,void *argument,unsigned int dosal)
int bioscom(int cmd,char abyte,int port)
int biosdisk(int cmd,int drive,int head,int track,int sector,int nsects,
void *buffer)
int biosequip(void)
int bioskey(int cmd)
int biosmemory(void)
int biosprint(int cmd,int abyte,int port)
int biostime(int cmd,long newtime)
int brk(void *addr)
double bessel(double x)
void *bsearch(const void *key,const void *base,size_t nelem,size_t width,
int (*fcmp)(const void *,const void *))
double cabs(struct complex z)
void *calloc(size_t nitems,size_t size)
double ceil(double x)
char *cgets(char *str)
int chdir(const char *path)
int _chmod(const char *path,int funct [,int attrib])
int chmod(const char *path,int amode)
int chsize(int handle,long size)
void far circle(int x,int y,int radius)
unsigned int _clear87(void)
void far cleardevice(void)
void clearerr(file *stream)
void far clearviewport(void)
clock_t clock(void)
int _close(int handle)
int close(int handle)
void far closegraph(void)
void clreol(void)
void clrscr(void)
unsigned int _control87(unsigned int new,unsigned int mask)
unsigned coreleft(void)
unsigned long coreleft(void)
double cos/cosh(double x)
struct country *country(int xcode,struct country *cp)
int cprintf(const char *format[,argument,...)
int cputs(const char *string)
int _creat(const char *path,int attrib)
int creat(char *path,int amode)
int creatnew(char *path,int attrib)
int creattemp(char *path,int attrib)
int cscanf(char *format[,address,...)
char *ctime(const time_t *time)
void ctrlbrk(int (*handler)(void))
void delay(unsigned milliseconds)
void delline(void)
void detectgraph(int far *graphdriver,int far *graphmode)
double difftime(time_t time2,time_t time1)
void _disable(void)
div_t div(int numer,int denom)
int dosexterr(struct DOSERROR *eblkp)
long dostounix(struct date *d,struct time *t)
void far drawpoly(int numpoints,int far *polypoints)
int dup(int handle)/dup2(int oldhandle,int newhandle)
char *ecvt(double value,int ndig,int *dec,int *sign)
void far ellipse(int x,int y,int stangle,int endangle,int xradius,int yradius)
void __emit__(argument,...)
void enable(void)
int eof(int handle)
int execl(char *path,char *arg0,*arg1,...,*argn,NULL)
int execle(char *path,char *arg0,*arg1,...,*argn,NULL,char **env)
int execlp(char *path,char *arg0,*arg1,...,*argn,NULL)
int execlpe(char *path,char *arg0,*arg1,...,*argn,NULL,char **env)
int execv(char *path,char *argv[])
int execve(char *path,char *argv[],char **env)
int execvp(char *path,char *argv[])
int execvpe(char *path,char *argv[],char **env)
void _exit/exit(int status)
double exp(double x)
double fabs(double x)
void far *farcalloc(unsigned long nunits,unsigned long unitsz)
unsigned long farcoreleft(void)
void farfree(void far *block)
void far *farmalloc(unsigned long nbytes)
void far *farrealloc(void far *oldblock,unsigned long nbytes)
int fclose(FILE *stream)/fcloseall(void)
char *fcvt(double value,int ndig,int *dec,int *sign)
file *fdopen(int handle,char *type)
int feof(FILE *stream)
int ferror(FILE *stream)
int ffush(FILE *stream)
int fgetc(FILE *stream)/fgetchar(void)
int fgetpos(FILE *stream,fpos_t *pos)
char *fgets(char *string,int n,FILE *stream)
long filelength(int handle)
int fileno(FILE *stream)
void far fillellipse(int x,int y,int xradius,int yradius)
void far fillpoly(int numpoints,int far *polypoints)
int findfirst(const char *pathname,struct ffblk *ffblk,int attrib)
int findnext(struct ffblk *ffblk)
void far floodfill(int x,int y,int border)
double floor(double x)
int flushall(void)
double fmod(double x,double y)
void fnmerge(char *path,const char *drive,const char *dir,const char *name,
const char *ext)
int fnsplit(const char *path,char *drive,char *dir,char *name,char *ext)
FILE *fopen(const char *path,const char *mode)
unsigned FP_OFF(farpointer)
void _fpreset(void)
int fprintf(FILE *stream,const char *format[,argument,...)
unsigned FP_SEG(farpointer)
int fputc(int c,FILE *stream)
int fputchar(int c)
int fputs(const char *string,FILE *stream)
size_t fread(void *ptr,size_t size,size_t n,FILE *stream)
void free(void *block)
int freemem(unsigned segx)
FILE *freopen(const char *filename,const char *mode,FILE *stream)
double frexp(double x,int *exponent)
int fscanf(FILE *stream,const char *format[,address,...])
int fseek(FILE *stream,long int offset,int whence)
int fsetpos(FILE *stream,const fpos_t *pos)
int fstat(int handle,struct stat *statbuf)
long int ftell(FILE *stream)
void ftime(struct timeb *buf)
size_t fwrite(const void *ptr,size_t size,size_t n,FILE *stream)
char *gcvt(double value,int nddec,char *buf)
void geninterrupt(int intr_num)
void far getarccoords(struct arccoordstype far *arccoords)
void far getaspectratio(int far *xasp,int far *yasp)
int far getbkcolor(void)
int getc(FILE *stream)
int getcbrk(void)
int getch(void)
int getchar(void)
int getche(void)
int far getcolor(void)
int getcurdir(int drive,char *directory)
char *getcwd(char *buf,int buflen)
void getdate(struct date *datep)
void far *far getdefaultpalette(void)
void getdfree(unsigned char drive,struct dfree *dtable)
int getdisk(void)
char *far getdrivername(void)
char far *getdta(void)
char *getenv(const char *name)
void getfat(unsigned char drive,struct fatinfo *dtable)
void getfatd(struct fatinfo *dtable)
void far getfillpattern(char far *pattern)
void far getfillsettings(struct fillsettingstype far *fillinfo)
int getftime(int handle,struct ftime *ftimep)
int far getgraphmode(void)
void far getimage(int left,int top,int right,int bottom,void far *bitmap)
void far getlinesettings(struct linesettingstype far *lineinfo)
int far getmaxcolor(void)
int far getmaxmode(void)
int far getmaxx(void)
int far getmaxy(void)
char *far getmodename(int mode_number)
void far getmoderange(int graphdriver,int far *lomode,int far *himode)
void far getpalette(struct palettetype far *palette)
int far getpalettesize(void)
char *getpass(const char *prompt)
unsigned far getpixel(int x,int y)
unsigned getpsp(void)
char *gets(char *string)
int gettext(int left,int top,int right,int bottom,void *destin)
void gettextinfo(struct text_info *r)
void far gettextsettings(struct textsettingstype far *texttypeinfo)
void gettime(struct time *timep)
void interrupt(*getvect(int interruptno))()
int getverify(void)
void far getviewsettings(struct viewporttype far *viewport)
int getw(FILE *stream)
int far getx/gety(void)
struct tm *gmtime(const time_t *timer)
void gotoxy(int x,int y)
void far graphdefaults(void)
char * far grapherrormsg(int errorcode)
void far _graphfreemem(void far *ptr,unsigned size)
void far *far _graphgetmem(unsigned size)
int far graphresult(void)
void harderr(int (*handler())
void hardresume(int axret)
void hardretn(int retn)
void highvideo(void)
double hypot(double x,double y)
unsigned far imagesize(int left,int top,int right,int bottom)
void far initgraph(int far *graphdriver,int far *graphmode,
char far *pathtodriver)
int inport(int portid)
unsigned char inportb(int portid)
void insline(void)
int far installuserdriver(char far *name,int huge (*detect)(void))
int far installuserfont(char far *name)
int int86(int intno,union REGS *inregs,union REGS *outregs)
int int86x(int intno,union REGS *inregs,union REGS *outregs,struct SREGS *seg)
int intdos(union REGS *inregs,union REGS *outregs)
int intdosx(union REGS *inregs,union REGS *outregs,struct SREGS *segregs)
void intr(int intno,struct REGPACK *preg)
int ioctl(int handl,int funct [,void *argdx,int argcxl])
int isalnum(int c)/isalpha(int c)/isascii(int c)
int isatty(int handle)
int iscntrl/isdigit/isgraph/islower/isprint/ispunct/isspace/isupper/
isxdigit(int c)
char *itoa(int value,char *string,int radix)
int kbhit(void)
void keep(unsigned char status,unsigned size)
long int labs(long int n)
double ldexp(double x,int exp)
ldiv_t ldiv(long int numer,long int denom)
void *lfind(const void *key,const void *base,size_t *num,size_t width,
int (*fcmp)(const void *,const void *))
void far line(int x1.int y1, int x2, int y2)
void far linerel(int dx,int dy)
void far lineto(int x,int y)
struct tm *localtime(const time_t *timer)
int lock(int handle,long offset,long length)
double log(double x)/log10(double x)
void longjmp(jmp_buf jmpb,int retval)
void lowvideo(void)
unsigned long _lrotl/_lrotr(unsigned long value,int count)
void *lsearch(const void *key,void *base,size_t *num,size_t width,int (*fcmp)
(const void *,const void *))
long lseek(int handle,long offset,int fromwhere)
char *ltoa(long value,char *string,int radix)
void *malloc(size_t size)
double _matherr(_mexcep why,char *fun,double *arg1p,double *arg2p,double retval)
int matherr(struc exception *e)
(type) max(a,b)
void *memccpy(const void *dest,const void *src,int c,size_t n)
void *memchr(const void *s,int c,size_t n)
int memcmp(const void *s1,const void *s2,size_t n)
void *memcpy(const void *dest,const void *src,size_t n)
int memicmp(const void *s1,const void *s2,size_t n)
void *memmove(void *dest,const void *src,size_t n)
void *memset(void *dest,int c,size_t n)
(type) min(a,b)
int mkdir(const char *path)
void far *MK_FP(unsigned seg,unsigned ofs)
char *mktemp(char *template)
double modf(double x,double *ipart)
void movedata(unsigned srcseg,unsigned srcoff,unsigned destoff,size_t n)
void far moverel(int dx,int dy)
int movetext(int left,int top,int right,int bottom,int destleft,int desttop)
void far moveto(int x,int y)
void movemem(void *src,void *dest,unsigned length)
void normvideo(void)
void nosound(void)
int _open(const char *filename,int oflags)
int open(const char *path,int access[,unsigned mode])
void outport(int portid,int value)
void outportb(int portid,unsigned char value)
void far outtext(char far *textstring)
void far outtextxy(int x,int y,char far *textstring)
char *parsfnm(const char *cmdline,struct fcb *fcb,int opt)
int peek(unsigned segment,unsigned offset)
char peekb(unsigned segment,unsigned offset)
void perror(const char *string)
void far pieslice(int x,int y,int stangle,int endangle,int radius)
void poke(unsigned segment,unsigned offset,int value)
void pokeb(unsigned segment,unsigned offset,int value)
double poly(double x,int degree,double coeffs[])
double pow(double x,double y)
double pow10(int p)
int printf(const char *format[,argument,...])
int putc(int c,FILE *stream)
int putchar(int c)
int putch(int c)
int putenv(const char *name)
void far putimage(int left,int top,void far *bitmap,int op)
void far putpixelint x,int y,int color)
int puts(const char *string)
int puttext(int left,int top,iny right,int bottom,void *source)
int putw(int w,FILE *stream)
void qsort(void *base,size_t nelem,size_t width,int (*fcmp)
(const void *,const void *))
int raise(int sig)
int rand(void)
int randbrd(struct fcb *fcb,int rcnt)
int randbwr(struct fcb *fcb,int rcnt)
int random(int num)
void randomize(void)
int _read/read(int handle,char *buffer,unsigned len)
void *realloc(void *buffer,size_t size)
void far rectangle(int left,int top,int right,int bottom)
int registerbgidriver(void (*driver)(void))
int registerbgifont(void (*font)(void))
int remove(const char *filename)
int rename(const char *oldname,const char *newname)
void far restorecrtmode(void)
void rewind(FILE *stream)
int rmdir(char *path)
unsigned _rotl/_rotr(unsigned value,int count)
void *sbrk(int incr)
int scanf(const char *format[,address,...])
char *searchpath(const char *file)
void far sector(int x,int y,int stangle,int endangle,int xradius,int yradius)
void segread(struct SREGS *segp)
void far setactivepage(int page)
void far setallpalette(struct palettetype far *palette)
void far setaspectratio(int xasp,int yasp)
void far setbkcolor(int color)
int setblock(unsigned segx,unsigned newsize)
int setcbrk(int cbrkvalue)
void far setcolor(int color)
void setdate(struct date *datep)
int setdisk(int disk)
void setdta(char far *dta)
void far setfillpattern(char far *upattern,int color)
void far setfillstyle(int pattern,int color)
int setftime(int handle,struct ftime *ftimep)
unsigned far setgraphbufsize(unsigned bufsize)
void far getgraphmode(int mode)
int setjmp(jmp_buf jmpb)
void far setlinestyle(int linestyle,unsigned upattern,int thickness)
void setmem(void *dest,unsigned length,char value)
int setmode(int handle,int amode)
void far setpalette(int colornum,int color)
void far setrgbpalette(int colornum,int red,int green,int blue)
void far settextjustify(int horiz,int vert)
void far settextstyle(int font,int direction,int charsize)
void settime(struct time *timep)
void far setusercharsize(int multx,int divx,int multy,int divy)
int setvbuf(FILE *stream,char *buffer,int type,size_t size)
void setvect(int interruptno,void interrupt(*isr)())
void setverify(int value)
void far setviewport(int left,int top,int right,int bottom,int clip)
void far setvisualpage(int page)
void far setwritemode(int mode)
void (*signal(int sig,void (*func),(int sig[,int subcode])))(int)
double sin(/sinh(double x)
void sleep(unsigned seconds)
int sopen(char *path,int access,int shflag,int mode)
void sound(unsigned frequency)
int spawnl(int mode,char *path,char *arg0,...,*argn,NULL)
int spawnle(int mode,char *path,char *arg0,...,*argn,NULL,char *envp[])
int spawnlp(int mode,char *path,char *arg0,...,*argn,NULL)
int spawnlpe(int mode,char *path,char *arg0,...,*argn,NULL,char *envp[])
int spawnv(int mode,char *path,char *argv[])
int spawnve(int mode,char *path,char *envp[])
int spawnvp(int mode,char *path)
int spawnvpe(int mode,char *path,char *envp[])
int sprintf(char *buffer,const char *format[,argument,...])
double sqrt(double x)
void srand(unsigned seed)
int sscanf(char *buffer,const char *format[,address,...])
int stat(char *path,struct stat *statbuf)
unsigned int _status87(void)
int stime(time_t *tp)
char *strcat(char *dest,const char *src)
char *strchr(const char *string,int c)
int strcmp(const char *string1,const char *string2)
int strcmpi(const char *string1,const char *string2)
char *strcpy(char *dest,const char *src)
size_t strcspn(const char *string1,const char *string2)
char *strdup(const char *string)
int stricmp(const char *string1,const char *string2)
char *strerror(int errnum)/_strerror(char *string)
size_t strlen(char *string)
char *strlwr(char *string)
char *strncat(char *dest,const char *src,size_t maxlen)
int strncmp(const char *string1,const char *string2 size_t maxlen)
int strnicmp(const char *string1,const char *string2,size_t maxlen)
char *strncpy(char *dest,const char *src,size_t maxlen)
char *strnset(char *string,int ch,size_t n)
char *strpbrk(const char *string1,const char *string2)
char *strrchr(const char *string,int c)
char *strrev(char *string)
char *strset(char *string,int ch)
size_t strspn(const char *string1,const char *string2)
char *strstr(const char *string1,const char *string2)
double strtod(const char *nptr,char **endptr)
char *strtok(char *string1,const char *string2)
long strtol(const char *s,char **endptr,int radix)
unsigned long strtoul(const char *s,char **endptr,int radix)
char *strupr(char *string)
void swab(char *src,char *dest,int nbytes)
int system(const char *command)
double tan/tanh(double x)
long tell(int handle)
void textattr(int newattr)
void textbackground(int newcolor)
void textcolor(int newcolor)
int far textheight(char far *textstring)
void textmode(int newcolor)
int far textwidth(char far *textstring)
time_t time(time_t *timer)
FILE *tmpfile(void)
char *tmpnam(char *s)
int toascii/tolower/_tolower/toupper/_toupper(int c)
void tzset(void)
char *ultoa(unsigned long value,char *string,int radix)
int ungetc(int c,FILE *stream)
int ungetch(int c)
void unixtodos(long time,struct,date *d,struct time *t)
int unlink(const char *filename)
int unlock(int handle,long offset,long length)
void va_start(va_list param,lastfix)
type va_arg(va_list param,type)
void va_end(va_list param)
int vfprintf(FILE *stream,const char *format,va_list arglist)
int vfscanf(FILE *stream,const char *format,va_list arglist)
int vprintf(const char *format,va_list argptr)
int vscanf(const char *format,va_list argptr)
int vsprintf(char *buffer,const char *format,va_list argptr)
int vsscanf(const char *buffer,const char *format,va_list argptr)
int wherex/wherey(void)
void window(int left,int top,int right,int bottom)
int _write/write(int handle,void *buffer,unsigned len)
. 6.1 Main line program structure
#include <???.h>
main()
{
}
. 6.2 Function Prototype Declaration
<type> function_name (type arg1,type arg2,...);
. 6.3 Function Definitions and Structure
<return type> function_name (arg1,arg2,...)
type arg1;
type arg2;
...
{
local declarations;
statements;
return statement;
}
. 7.1 Sample of Main Program
/* sample 1 */
#include <stdio.h>
main()
{
printf("Welcome to Turbo C programming with kEDITOR");
}
. 7.2 Sample of Main Program Calling a Function
/* sample 2 */
#include <stdio.h>
main()
{
int i;
for (i = 0; i < 10; ++i)
printf("%d %d %d\n", i,power(2,i), power(-3,i));
}
power(x,n)
int x,n;
{
int i,p;
for (i = 1; i <= n; ++i)
p = p * x;
return(p);
}
. 7.3 Sample of DO statement
/* sample 3 */
do {
i--;
} while (i > 0);
. 7.4 Sample of FOR statement
/* sample 4 */
for (i = 0; sum = 0; i < 100; i++)
sum += a[i];
. 7.5 Sample of GOTO statement
/* sample 5 */
if (result > 0)
goto quit;
...
quit:
return(result);
. 7.6 Sample of IF statement
/* sample 6 */
#include <stdio.h>
FILE *in_file;
main()
{
if ((in_file = fopen("data","r")) == NULL)
printf("Open file failed");
else
printf("File Opened");
}
. 7.7 Sample of SWITCH statement
/* sample 7 */
response = toupper(response);
switch (reponse) {
case 'Y':
printf("The reponse is Yes");
break;
case 'N':
printf("The reponse is No");
break;
default :
printf("The reponse is uncertain");
}
. 7.8 Sample of WHILE statement
/* sample 8 */
while (( achar = getchar()) != EOF) {
if achar == ' ')
continue;
putchar(achar);
count++;
}
. 7.9 Sample of Command-line Processing
/* sample 9 */
#include <stdio.h>
main(argc,argv)
int argc;
char *argv[];
{
int i;
printf("Number of arguments : %d\n",argc);
for (i = 1; i <argc; i++)
printf("%s\n",argv[i]);
}
. 7.10 Sample of Array Using
/* sample 10 */
#include <stdio.h>
main()
{
int array1[26];
int i;
for (i = 0; i < 26; ++i)
{
array1[i] = i + 'a';
putchar(array1[i]);
}
putchar('\n');
}
. 7.11 Sample of File I/O
/* sample 11 */
#include <stdio.h>
main()
{
FILE *fopen(), *in_file, *out_file;
char achar;
in_file = fopen("IN.DAT", "r");
out_file = fopen("OUT.DAT","w");
if (in_file == NULL)
printf ("Input file not found%s\n",in_file);
while ((achar = getc (in_file)) != EOF) {
fputc(achar,out_file);
}
fclose (in_file);
fclose (out_file);
}
. 7.12 Sample of Text File Input
/* sample 12 */
#include <stdio.h>
main()
{
FILE *in_file, *fopen();
char line[80];
in_file = fopen("INFILE.TXT","r");
while (fgets(line,80,in_file) != NULL)
puts(line);
fclose (in_file);
}
. 7.13 Sample of Text File Output
/* sample 13 */
#include <stdio.h>
main()
{
FILE *out_file, *fopen();
int i;
char name[80];
out_file = fopen("NAMELIST.TXT","w");
do {
printf("Enter name :");
gets(name);
if ((i = strlen(name)) > 0)
fputs(name,out_file);
} while (i > 0);
fclose (out_file);
}
. 7.14 Sample of Memory Storage Allocation
/* sample 14 */
#include <stdio.h>
struct block {
int lineNo;
char Line[80];
};
main()
{
char *malloc();
struct block *p;
p = (struct block *) malloc (sizeof(struct block));
if (p == (struct block *) NULL)
printf("Out of Memory\n");
else
printf("Memory allocated OK\n");
}
. 8. Escape Sequences
\0 Null terminator (for string) 0X0 ^@
\a bell(alert)
\b backspace 0X5C \
\f form feed 0X0C ^L
\n new line 0X0A ^J
\r carriage return 0X0D ^M
\t horizontal tab (six spaces) 0X9
\v vertical tab
\' single quoatation mark 0X27
\" double quotation mark 0X22
\\ backslash
\ddd octal value
\xdd Hex value
. 9. Format Specifications
%u unsigned integer
%ld long integer
%p pointer value
%f floating-point
%e floating-point in exponential notation
%c Character
%s String
%x %X Hexadecimal integer
.10. Preprocessor Directives
#define <identifier> <text>
#error <identifier>
#include <path name>
#if <exp> [text] [#elif <exp> text] [#elif <exp> text]...[#else text] #endif
#ifdef <identifier>
#ifndef <identifier>
#line <constant> ["filename"]
#undef <identifier>
#pragma <identifier>
.11.1 Compiler Options in Function Group
Memory model option (-mc -mh -ml -mm -ms -mt)
#define(Macro Definition) (-Dname -Dname=str -Uname)
Code generation option (-1 -a -d -f87 -f -f- -K -k -N -p -u -y -v)
Optimization option (-G -O -r- -r -Z)
Source code option (-A -C -i#)
Error_reporting options (-g# -j# -wstr)
Segment-nameing control option (-zXname where X is A/B/C/D/G/P/R/S/T)
Compilation control options (-B -c -ofilename -S -Efilename)
Linker options (-efilename -M -lx)
Environment options (-Ipath -Lpath -npath)
.11.2 Compiler Options in Alphbetic Order
>TCC <option1> <option2> ... <options> filename filename ...
-1 Generate code for the 186/286 instruction set
-1- Generate code for the 8088/8086 instruction set (default)
-A ANSI keywords only
-a Align integer size variables and structure fields on a word boundary
-a- Align integer size variables and structure fields on byte boundary
-B Process inline assembly code
-C Allow nested comments
-c Compile only
-Dname Define name to be 1 to the preprocessor
-Dname=str Define name to be str to be preprocessor
-d Merge duplicate constant strings
-Efilename Name of assembler to use (default TASM)
-efilename Name of executable file
-f Floating point emulation(default)
-f- Do not use floating-point libraries at link time
-f87 8087 floating-point operations
-G Optimize for speed rather than size
-g# Compiling stop after # errors and warnings
-Ipath Include directories
-i# Set identifier size to # significant characters(default 32)
-j# Compiling stop after # errors
-K Default char type to unsigned
-K- Default char type to signed
-Lpath Library directory
-M Produce a link map file
-mc Model compact
-mh Model huge
-ml Model large
-mm Model medium
-ms Model small
-mt Model tiny
-N Generate code for stack probe upon entry to functions(default)
-npath Output directory
-O Optimization on jump
-ofilename OBJ filename
-p Pascal calling convention
-p- C calling convention
-r Use register variables(default)
-r- Disable register variables
-S Produce assembly source listing in .ASM
-Uname Undefine preprocessor symbol name
-u Generate underscore on the front of identifiers(default)
-v Generate debug information in OBJ file
-w Display warning(default)
-w- Do not display warning
-wstr Enable warning message associated with str
-w-str Suppress warning message associated with str
-y Generate line number for debugging
-Z Optimization on register loading
-zAname Change name of code segment class to name(default CODE)
-zBname Change name of uninitialzed data segment class to name(default BSS)
-zCname Change name of code segment to name(default -TEXT)
-zDname Change name of uninitialzed data segment to name(default _BSS)
-zGname Change uninitialzed data segment group to name(default DGROUP)
-zPname Cause output file to be generated with a code group name
-zRname Change name of initialzed data segment to name(default _DATA)
-zSname Change initialzed data segment group to name(default DGROUP)
-zTname Change initialzed data segment class to name(default DATA)
-zX* Use the default name to X
.12. Display Mode for IBM PC and Compatiables
Type Adapter Type Monitor Type Size Colors
-------------- ------------ -------------------- --------- ------
Mono text CGA,EGA Color,Extended Color 40 x 25 16 shades
Color text CGA,EGA Color,Extended Color 40 x 25 16
Mono text CGA,EGA Color,Extended Color 80 x 25 16 shades
Color text CGA,EGA Color,Extended Color 80 x 25 16
Color graphics CGA,EGA Color,Extended Color 320 x 200 4
Mono graphics CGA,EGA Color,Extended Color 320 x 200 4 shades
Mono graphics CGA,EGA Color,Extended Color 640 x 200 2 B & W
Mono text Mono Mono 80 x 25 2 B & W
Hercules graphics Hercules Color,Extended Color 720 x 348 2 B & W
Color graphics EGA Color,Extended Color 320 x 200 16
Color graphics EGA Color,Extended Color 640 x 200 16
Mono graphics EGA Extended Color 640 x 350 2 B & W
Color graphics EGA Extended Color 640 x 350 4 / 16
Mono graphics VGA VGA 640 x 480 2 B & W
Color graphics VGA VGA 640 x 480 16
Color graphics VGA VGA 320 x 200 256